package com.prp.gwt.client.widgets.user.article;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.prp.gwt.client.user.article.ArticleListener;
import com.prp.gwt.client.vo.EntityList;

public class SystemTopEntityPanel extends VerticalPanel{
	private static SystemTopEntityPanel instance;
	private VerticalPanel innerPanel = new VerticalPanel();
	private Image loadImage = new Image(GWT.getModuleBaseURL() + "loading.gif");
	
	public static SystemTopEntityPanel getInstance(){
		return instance;
	}
	
	public SystemTopEntityPanel(){
		instance = this;
		HTML title = new HTML("热门实体");
		title.addStyleName("systemTopEntity-title");
		add(title);
		add(loadImage);
		add(innerPanel);
		ArticleListener.getInstance().getTopEntity();
	}
	
	public void loadEntityList(EntityList list){
		loadImage.setVisible(false);
		for(int i = 0; i < list.size() && i < 8; i++)
			innerPanel.add(new SimpleEntityItem(list.get(i)));
	}
}
